package sphere.controller;

import java.awt.TextField;
import java.awt.event.TextEvent;
import java.awt.event.TextListener;

import sphere.model.Sphere;
import sphere.view.SphereWindow;

public class SphereController implements TextListener {
	
	SphereWindow src;
	public SphereController(SphereWindow src)
	{
		this.src=src;
	}
	
	@Override
	public void textValueChanged(TextEvent arg0)
	{
		TextField t = (TextField)arg0.getSource();
		Sphere maSphere = new Sphere(Double.parseDouble(t.getText()));
		src.setSurfaceAreaT(String.valueOf(maSphere.calculSurface()));
		src.setVolumeT(String.valueOf(maSphere.calculVolume()));
		
	}

}
